package com.quasar.hpatient.presenter;
import com.quasar.hpatient.model.httpmodel.DataStateResult;
import com.quasar.hpatient.model.requestmodel.RequestModel;
import com.quasar.hpatient.onInterface.AnotherResultListener;
import com.quasar.hpatient.onInterface.ExternalRecordsListener;

/**
 * author : 许建宏
 * Date: 2018/1/24 0024
 * View:
 */

public class ExternalRecordsPresenter {

    private RequestModel requestModel;
    private ExternalRecordsListener listener;

    public ExternalRecordsPresenter(ExternalRecordsListener listener) {
        this.requestModel = new RequestModel();
        this.listener = listener;
    }

    public void ExternalRecords(String dataValue,String logTime){
        requestModel.AddExternalRecords(dataValue,logTime, new AnotherResultListener<DataStateResult>() {
            @Override
            public void onSuccess(DataStateResult data) {
                listener.onExternalRecordsSuccess(data);
            }

            @Override
            public void onError(String msg) {
                listener.onExternalRecordsError(msg);
            }

            @Override
            public void onRefreshUI() {
                listener.onExternalRecordsRefreshUI();
            }
        });
    }
}
